﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FJERP.BLL;

namespace FJERP
{
    public partial class Blitem_ShowMain : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                FenyeBlitem();
            }
        }
        public void FenyeBlitem()
        {
            BlitemBLL bll = new BlitemBLL();
            this.AspNetPager1.PageSize = 4;
            this.AspNetPager1.RecordCount = bll.Count();
            this.Repeater1.DataSource = bll.ShowBlitem(this.AspNetPager1.PageSize, this.AspNetPager1.CurrentPageIndex);
            this.Repeater1.DataBind();
            this.Label1.Text = this.AspNetPager1.RecordCount.ToString();
        }
        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            if (this.TextBox1.Text == null || this.TextBox1.Text == "")
            {
                FenyeBlitem();
            }
            else {
                SelectBlitem();
            }
        }
        public void SelectBlitem()
        {
            BlitemBLL bll = new BlitemBLL();
            this.AspNetPager1.PageSize = 4;
            this.AspNetPager1.RecordCount = bll.Count(this.TextBox1.Text);
            this.Repeater1.DataSource = bll.SelectBlitem(this.AspNetPager1.PageSize, this.AspNetPager1.CurrentPageIndex, this.TextBox1.Text);
            this.Repeater1.DataBind();
            this.Label1.Text = this.AspNetPager1.RecordCount.ToString();
        }
        protected void Unnamed_ServerClick(object sender, EventArgs e)
        {
            SelectBlitem();
        }
    }
}